package com.ai.bitcoin.helper;

import com.ai.bitcoin.jpa.entity.BccSubCoin;
import com.ai.bitcoin.service.MakeHtmlService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;

/**
 * @description: ${description}
 * @author: gulj
 * @create: 2018-06-13 00:39
 **/
public class MakeHtmlServiceHelper {


    public static Map<String,List<String>> buildBccIdToUsers(List<BccSubCoin> subCoins) {
        Map<String,List<String>> data = Maps.newHashMap();
        for(BccSubCoin subCoin : subCoins) {
            if(data.get(subCoin.getBccId()) == null) {
                List<String> openIds = Lists.newArrayList();
                openIds.add(subCoin.getUserOpenId());
                data.put(subCoin.getBccId(),openIds);
            } else {
                data.get(subCoin.getBccId()).add(subCoin.getUserOpenId());
            }
        }
        return data;
    }

}
